package serwers;

import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
import java.net.Socket;

/**
 *
 * This class's main task is to take care of clients problems and other stuff.
 *
 */
public class WorkerRunnable implements Runnable {
	protected Socket clientSocket = null;
	protected String serverText = null;

	public WorkerRunnable(Socket clientSocket, String serverText) {
		this.clientSocket = clientSocket;
		this.serverText = serverText;
	}

	public void run() {
		try {
			InputStream input = clientSocket.getInputStream();
			OutputStream output = clientSocket.getOutputStream();
			/**
			 * Here Server's response if client has connected.
			 */
			output.write(("Connected " + "Witamy w poczekalni do badugi :)")
					.getBytes());
			System.out.println("Connected from "
					+ clientSocket.getInetAddress().getHostName() + " on time "
					+ System.currentTimeMillis() + "");
			output.close();
			input.close();
		} catch (IOException e) {
			throw new RuntimeException("Closing", e);
		}
	}
}
